package view
{
	import flash.display.Bitmap;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class NavigationItem extends Sprite
	{
		public var vy:Number;
		public var targetY:Number;
		public var baseTargetY:Number;
		public var downTargetY:Number;
		public var tagergeID:int;
		private var _content:Sprite;
		private var _fun:Function;
		public function NavigationItem(bitmapClass:Class,content:Sprite,
									   parent:DisplayObjectContainer=null, baseTargetY:Number=0,downTargetY:Number=0,
									   tagergeID:Number=0,fun:Function=null)
		{
			var bitmap:Bitmap = new bitmapClass();
			this.addChild(content);
			content.y = 28;
			_content = content;
			this.addChild(bitmap);
			this.graphics.beginFill(0xd5cfc6);
			this.graphics.drawRect(0,0,158,407);
			this.graphics.endFill();
			
			if(parent != null)
			{
				parent.addChild(this);
			}
			this.y = this.baseTargetY = baseTargetY;
			this.downTargetY = downTargetY;
			this.tagergeID = tagergeID;
			this.addEventListener(MouseEvent.CLICK,click);
			_fun = fun;
		}
		private function click(event:MouseEvent):void{
			if(this.mouseY < 28){
				_fun(event);
			}
		}
		public function show():void{
			if(_content is ItemDetails){
				BorderList(ItemDetails(_content).p).setData();
			}
		}
		
	}
}